home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 051-075 / disk_066 / foogol / test.s.reference < prev   
Text File  |  1992-05-06  |  2KB  |  163 lines

  1.     .text    #    #    begin
  2.     .align    1
  3.     .globl    _main
  4. _main:
  5.     .word    0
  6.     .data    1    #    integer
  7. n:    .long    0
  8. div:    .long    0
  9. sub:    .long    0
  10. test:    .long    0
  11. testcopy:    .long    0
  12. found:    .long    0
  13. max:    .long    0
  14.     .text
  15.     movl    $2,r0
  16.     movl    r0,test    #    test:=
  17.     movl    $10,r0
  18.     movl    r0,max    #    max:=
  19. L0:    #    #    #    while
  20.     movl    n,r0
  21.     pushl    r0    #    <>
  22.     movl    max,r0
  23.     cmpl    (sp)+,r0
  24.     beql    L3
  25.     movl    $1,r0
  26.     jmp    L4
  27. L3:    movl    $0,r0
  28. L4:
  29.     tstl    r0
  30.     bneq    L2
  31.     jmp    L1
  32. L2:    #    #    #    do
  33.     #    #    #    begin
  34.     movl    test,r0
  35.     pushl    r0    #    -term
  36.     movl    $1,r0
  37.     subl3    r0,(sp)+,r0
  38.     movl    r0,div    #    div:=
  39.     movl    $0,r0
  40.     movl    r0,found    #    found:=
  41. L5:    #    #    #    while
  42.     movl    div,r0
  43.     pushl    r0    #    -term
  44.     movl    $1,r0
  45.     subl3    r0,(sp)+,r0
  46.     tstl    r0
  47.     bneq    L7
  48.     jmp    L6
  49. L7:    #    #    #    do
  50.     #    #    #    begin
  51.     movl    test,r0
  52.     movl    r0,testcopy    #    testcopy:=
  53.     movl    $0,r0
  54.     movl    r0,sub    #    sub:=
  55. L8:    #    #    #    while
  56.     movl    testcopy,r0
  57.     tstl    r0
  58.     bneq    L10
  59.     jmp    L9
  60. L10:    #    #    #    do
  61.     #    #    #    begin
  62.     movl    sub,r0
  63.     pushl    r0    #    +term
  64.     movl    $1,r0
  65.     addl2    (sp)+,r0
  66.     movl    r0,sub    #    sub:=
  67.     movl    sub,r0
  68.     pushl    r0    #    =
  69.     movl    div,r0
  70.     cmpl    (sp)+,r0
  71.     beql    L14
  72.     movl    $0,r0
  73.     jmp    L15
  74. L14:    movl    $1,r0
  75. L15:
  76.     tstl    r0    #    if
  77.     bneq    L13    #    then
  78.     jmp    L12
  79. L13:
  80.     movl    $0,r0
  81.     movl    r0,sub    #    sub:=
  82.     jmp    L11
  83. L12:    #    #    #    else
  84. L11:    #    #    #    endif
  85.     movl    testcopy,r0
  86.     pushl    r0    #    -term
  87.     movl    $1,r0
  88.     subl3    r0,(sp)+,r0
  89.     movl    r0,testcopy    #    testcopy:=
  90.     #    #    #    end
  91.     jmp    L8
  92. L9:    #    #    #    endwhile
  93.     movl    sub,r0
  94.     pushl    r0    #    =
  95.     movl    $0,r0
  96.     cmpl    (sp)+,r0
  97.     beql    L19
  98.     movl    $0,r0
  99.     jmp    L20
  100. L19:    movl    $1,r0
  101. L20:
  102.     tstl    r0    #    if
  103.     bneq    L18    #    then
  104.     jmp    L17
  105. L18:
  106.     movl    $1,r0
  107.     movl    r0,found    #    found:=
  108.     jmp    L16
  109. L17:    #    #    #    else
  110. L16:    #    #    #    endif
  111.     movl    div,r0
  112.     pushl    r0    #    -term
  113.     movl    $1,r0
  114.     subl3    r0,(sp)+,r0
  115.     movl    r0,div    #    div:=
  116.     #    #    #    end
  117.     jmp    L5
  118. L6:    #    #    #    endwhile
  119.     movl    found,r0
  120.     pushl    r0    #    =
  121.     movl    $0,r0
  122.     cmpl    (sp)+,r0
  123.     beql    L24
  124.     movl    $0,r0
  125.     jmp    L25
  126. L24:    movl    $1,r0
  127. L25:
  128.     tstl    r0    #    if
  129.     bneq    L23    #    then
  130.     jmp    L22
  131. L23:
  132.     #    #    #    begin
  133.     movl    n,r0
  134.     pushl    r0    #    +term
  135.     movl    $1,r0
  136.     addl2    (sp)+,r0
  137.     movl    r0,n    #    n:=
  138.     movl    test,r0
  139.     pushl    r0    #    printn
  140.     calls    $1,_PRN
  141.     .data    1    #    prints
  142. L26:    .asciz    " is prime number "
  143.     .text
  144.     pushal    L26
  145.     calls    $1,_PRS
  146.     movl    n,r0
  147.     pushl    r0    #    printn
  148.     calls    $1,_PRN
  149.     calls    $0,_PR    #    print
  150.     #    #    #    end
  151.     jmp    L21
  152. L22:    #    #    #    else
  153. L21:    #    #    #    endif
  154.     movl    test,r0
  155.     pushl    r0    #    +term
  156.     movl    $1,r0
  157.     addl2    (sp)+,r0
  158.     movl    r0,test    #    test:=
  159.     #    #    #    end
  160.     jmp    L0
  161. L1:    #    #    #    endwhile
  162.     ret    #    #    end
  163.